<?php

namespace app\common\model;

use think\Db;
use think\Model;

class UserSGold  extends Model
{

    // 表名
    protected $name = 'user_sgold';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';



    public function gGoldU($nums,$user_id,$title){
        $this->save([
            'nums'=>$nums,
            'user_id'=>$user_id,
            'title'=>$title
        ]);
        Db::name('user')->where('id',$user_id)->inc('sgold',$nums)->update();
    }
}